#pragma once
#include"HashTable.h"

template<class K ,class V>
struct KeyofMap
{
	const K& operator()(const pair<K,V>& kv)
	{
		return kv.first;
	}
};

template<class K,class V, class HF = Hash<K>>
class Unordered_map
{
public:
	typedef pair<K, V> T;
	typedef typename LinkHash::HashTable<K, T, KeyofMap<K, V>, Hash<K>>::iterator iterator;

	iterator begin()
	{
		return hst.begin();
	}

	iterator end()
	{
		return hst.end();
	}

	bool insert(const T& data)
	{
		return hst.Insert(data);
	}

	bool Erase(const K& key)
	{
		return hst.Erase(key);
	}

	LinkHash::HashNode<T>* Find(const K& key)
	{
		return hst.Find(key);
	}

private:
	LinkHash::HashTable<K, T, KeyofMap<K,V>,Hash<K>> hst;
};